/*
Kakine
ActionScript Framework
Copyright © 2011, PUNY, LLC.

This file is part of KAKINE.

KAKINE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

KAKINE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with KAKINE.  If not, see <http://www.gnu.org/licenses/>.
*/ 
package com.puny.ball.utils
{
	import flash.geom.Point;

	public class Vector2D extends Point
	{
		public function Vector2D(x:Number=0, y:Number=0)
		{
			super(x, y);
		}
		
		public function dot(pt:Point):Number {
			return x * pt.x + y * pt.y;
		}
		
		public function multiply(n:Number):Point {
			var p:Vector2D = new Vector2D();
			p.x = x * n;
			p.y = y * n;
			return p;
		}
		
		override public function add(v:Point):Point {
			var p:Vector2D = new Vector2D();
			p.x = x + v.x;
			p.y = y + v.y;
			return p;
		}

		override public function subtract(v:Point):Point {
			var p:Vector2D = new Vector2D();
			p.x = x - v.x;
			p.y = y - v.y;
			return p;
		}
	}
}